<template>
  <loading-text v-if="loading"></loading-text>
  <div v-else class="form-list">
    <div class="form-list-item">
      <span class="label">姓名：</span>
      <span class="content">{{detail.aac003 || '--'}}</span>
    </div>
    <div class="form-list-item">
      <span class="label">身份证号：</span>
      <span class="content">{{detail.aac002 || '--'}}</span>
    </div>
    <div class="form-list-item">
      <span class="label">工作单位：</span>
      <span class="content">{{detail.company || '--'}}</span>
    </div>
    <div class="form-list-item">
      <span class="label">报名课程：</span>
      <span class="content">{{detail.course || '--'}}</span>
    </div>
    <div class="form-list-item">
      <span class="label">报名年份：</span>
      <span class="content">{{detail.learnYear || '--'}}</span>
    </div>
    <div class="form-list-item">
      <span class="label">学习状态：</span>
      <span class="content" :class="{danger: Number(detail.learnStatusCode) === 0}">{{detail.learnStatus || '--'}}</span>
    </div>
    <div class="form-list-item">
      <span class="label">报名序号：</span>
      <span class="content">{{detail.serialNumber || '--'}}</span>
    </div>
    <yd-lightbox :num="detail.conPaperPath.length" v-if="detail.conPaperPath">
      <div class="form-list-item" v-for="(val, key) in detail.conPaperPath" :key="key">
        <div class="label">附件{{key + 1}}：</div>
        <div class="content">
          <yd-lightbox-img :src="$getImg(val)" class="img"></yd-lightbox-img>
        </div>
      </div>
    </yd-lightbox>
    <mt-button size="large" type="primary" v-if="detail.conEduCertPath">下载合格证明</mt-button>
  </div>
</template>

<script>
  import LoadingText from '../../../components/loading-text/loading-text'
  import {download} from '../../../common/js/util'

  export default {
    name: 'detail-certify',
    components: {LoadingText},
    data() {
      return {
        loading: true,
        detail: {}
      }
    },
    methods: {
      getDetail() {
        this.$post('/admin/person/sapi/education/continuing/get/certification/detail/info', {
          learnYear: this.$route.query.id
        }, loading => { this.loading = loading }).then(res => {
          this.detail = res.data
        })
      },
      apply() {
        // 下载合格证明
        download(this.$getImg(this.detail.conEduCertPath, {type: 'pdf'}))
      }
    },
    created() {
      this.getDetail()
    }
  }
</script>

<style scoped lang="scss">
  @import "../../../common/style/variable";
  .danger{
    color: $danger;
  }
  .img{
    width: 2.5rem;
  }
</style>
